package com.chenfan.mcn.clients.finance;

import com.chenfan.common.vo.Response;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

/**
 * @author: tangwei
 * Date:     2021/3/4 18:29
 * Description: 财务feign接口
 */
@FeignClient(value = "chenfan-cloud-finance")
public interface FinanceClient {

    @PostMapping("/charge/common/clearData4ExecuteOrder")
    Response<Map<String, ClearData4ExecuteOrderVo>> clearData4ExecuteOrder(@RequestBody List<String> executeOrderNoList);

    /**
     * 根据来源单号、来源明细查询是否有未删除状态费用
     *
     * @param chargeSourceDetail
     * @param chargeSourceCode
     * @return Response<Integer>
     */
    /*@GetMapping("/charge/common/getRelatedCount")
    Response<Integer> getRelatedCount(@RequestParam(required = false) String chargeSourceCode, @RequestParam(required = false) String chargeSourceDetail);*/

    /**
     * 根据来源单号、来源明细查询是否有未作废未删除状态费用
     *
     * @param chargeSourceCode
     * @param chargeSourceDetail
     * @param chargeType
     * @return Response<Integer>
     */
    @GetMapping("/charge/common/getInvalid")
    Response<Integer> getInvalid(@RequestParam(required = false) String chargeSourceCode,
                                 @RequestParam(required = false) String chargeSourceDetail,
                                 @RequestParam(required = false) Integer chargeType);

    /**
     * 通过财务结算单号获取对应ID
     *
     * @param invoiceNo
     * @return Response<Long>
     */
    @GetMapping("/invoice/common/getId")
    Response<Long> getInvoiceIdByNo(@RequestParam("invoiceNo") String invoiceNo);

    /**
     * 根据来源单号获取mcn费用信息
     *
     * @param chargeSourceCode
     * @return Response<List < McnChargeCommonVO>>
     */
    @GetMapping("/charge/common/getMcnCharge")
    Response<List<McnChargeCommonVO>> getMcnCharge(@RequestParam String chargeSourceCode);

    /**
     * 根据收入合同编号获取mcn发票信息
     *
     * @param contractCode
     * @return Response<List < McnTaxInvoiceVo>>
     */
    @GetMapping("/tax/invoice/getMcnTaxInvoice")
    Response<List<McnTaxInvoiceVo>> getMcnTaxInvoice(@RequestParam String contractCode);


    /**
     * 根据收入合同编号获取MCN核销信息
     *
     * @param contractCode
     * @return Response<List < McnClearVo>>
     */
    @GetMapping("/cfClear/common/getMcnClear")
    Response<List<McnClearVo>> getMcnClear(@RequestParam String contractCode);


    /**
     * 数据归属人转移
     * @param dto
     * @return
     */
    @PostMapping("/upstream/data/move")
    Response<FinanceDataMoveVo> dataMove(@RequestBody FinanceDataMoveDto dto);

    /**
     * 数据归属人转移数据一致性回滚接口
     * @param dto
     * @return
     */
    @PostMapping("/upstream/data/move/rollback")
    Response<Boolean> dataMoveRollback(@RequestBody FinanceDataMoveDto dto);

    /**
     *根据chargeSourceCode获取账单信息
     * @param chargeSourceCode
     * @return
     */
    @GetMapping("/charge/common/getMcnInvoice")
    Response<List<FinanceInvoiceDTO>> getMcnInvoice(@RequestParam String chargeSourceCode);

    /**
     * 更新财务主体数据
     * @param dto
     * @return
     */
    @PostMapping("/charge/common/updateFinanceEntity")
    Response<Object> updateFinanceEntity(@RequestBody FinanceEntityUpdateDto dto);


    /**
     * 根据
     * @param chargeSourceCode
     * @return
     */
    @GetMapping("/charge/common/existTaxInvoiceOrClear")
    Response<FinanceVerifyResultVo> existTaxInvoiceOrClear(@RequestParam String chargeSourceCode);


    /**
     * 查询已开票金额
     * @param chargeSourceCodeList
     * @return
     */
    @PostMapping("/tax/invoice/summaryInvoicedAmount")
    Response<List<SummaryInvoicedAmountVO>> summaryInvoicedAmount(@RequestBody List<String> chargeSourceCodeList);
}